import com.zeng.pojo.Student;
import com.zeng.pojo.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author zeng
 * @data 2021/06/06 19:06
 */
public class Mytest {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
        Student student = (Student) context.getBean("student");
        System.out.println(student.toString());
//        ApplicationContext context = new ClassPathXmlApplicationContext("Userbeans.xml");
//        ApplicationContext context1 = new ClassPathXmlApplicationContext("beans.xml");
//        User user = context.getBean("user", User.class);
//        Student user1 = context1.getBean("student", Student.class);
    }
    @Test
    public void TestSingleton(){
       ApplicationContext context = new ClassPathXmlApplicationContext("Userbeans.xml");
        User user1 = context.getBean("user", User.class);
        User user2 = context.getBean("user", User.class);
        System.out.println(user1.equals(user2));

    }
}
